import 'package:dio/dio.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:yueyin/global/my_dio.dart';

class Yin {

  static Yin? _instance;

  late Dio _dio;

  //需要在main方法中 初始化
  late SharedPreferences _preferences;

  factory Yin() {
    if (_instance == null) {
      _instance = Yin._();
      _instance!._dio = MyDio.dio;
    }
    return _instance!;
  }

  Yin._();

  Dio get dio => _dio;

  initPref(SharedPreferences preferences){
    _preferences = preferences;
  }

  SharedPreferences get preferences => _preferences;
}
